<include file="Public:header" />

<div id="page-body">
    <div id="qan-breadcrumbs"><span><a href="{$_global.site_url}">{$Think.lang.home}</a></span>&gt;&nbsp;<span>{$Think.lang.invitation}</span></div>
    <p>{$Think.lang.invite_tips}</p>
    <form method="POST" action="{:U('Invitation/makeKey')}">
        <table class="tb">
            <tr>
                <td align="right">{$Think.lang.invite_credits}:</td>
                <td><em>{$invite.credits}</em></td>
            </tr>        
            <tr>
                <td align="right">{$Think.lang.invite_next_credit}:</td>
                <td><em>{$invite.next_credit|format_date}</em></td>
            </tr>
            <tr><td colspan="2"></td></tr>
            <tr>
                <td colspan="2">
                	<gt name="invite.credits" value="0"><input type="submit" class="button" value="{$Think.lang.invite_make_key}" />
                	<else/>
                	<input type="submit" class="alt-button" value="{$Think.lang.invite_make_key}" disabled />
                	</gt>
                </td>
            </tr>
            <tr><td colspan="2"></td></tr>
            <tr><td colspan="2"></td></tr>
        </table>
	</form>
	
	<ul id="invite-nav" class="tabs">
        <li <eq name="type" value="valid">class="current"</eq>><a href="{:U('Invitation/index',array('type'=>'valid'))}">{$Think.lang.invite_status_valid}</a></li>
        <li <eq name="type" value="expired">class="current"</eq>><a href="{:U('Invitation/index',array('type'=>'expired'))}">{$Think.lang.invite_status_expired}</a></li>
        <li <eq name="type" value="used">class="current"</eq>><a href="{:U('Invitation/index',array('type'=>'used'))}">{$Think.lang.invite_status_used}</a></li>
    </ul>
	<notempty name="invitationKeys">
    <div class="container">
	    <table class="tb tb-list">
	        <tr>
	            <th width="30%">{$Think.lang.invite_key}</th>
	            <th>{$Think.lang.create_time}</th>
	            <th>{$Think.lang.expire_time}</th>
	            <eq name="type" value="used">
	            <th>{$Think.lang.invite_register_user}</th>
	            <th>{$Think.lang.invite_register_time}</th>
	            </eq>
	        </tr>
	        <volist name="invitationKeys" id="vo">
	        <tr>
	        	<td><eq name="vo.status" value="1"><a href="javascript:setCopy('{$vo.key}','{$Think.lang.copy_link_ok}');" title="{$Think.lang.invite_copy_key}">{$vo.key}</a><else/>{$vo.key}</eq>	</td>
	            <td>{$vo.create_time|format_date}</td>
	            <td>{$vo.expire_time|format_date}</td>
	            <eq name="type" value="used">
	            <td><a href="{$vo.register_user_id|format_user_url=$vo['register_username']}">{$vo.register_username}</a></td>
	            <td>{$vo.register_time|format_date}</td>
	         	</eq>
	        </tr>
	        </volist>
	    </table>
	</div>
	<div class="pagination">{$pagination}</div>
	<else/>
	<p class="no-results">{$Think.lang.invite_no_results}</p>
	</notempty>
	
</div>

<include file="Public:footer" />